package com.jzr.pda.db1.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jzr.pda.db1.mapper.MyPatientMapper;
import com.jzr.pda.db1.mapper.TChargeMapper;
import com.jzr.pda.db1.model.TCharge;
import com.jzr.pda.db1.model.TPatient;
import com.jzr.pda.db1.service.TPatientService;
import com.jzr.pda.db1.vo.PatientVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TPatientServiceImpl extends ServiceImpl<MyPatientMapper, TPatient> implements TPatientService {
    @Autowired
    private TChargeMapper chargeMapper;

    @Override
    public List<PatientVo> list(String deptCode) {
        return baseMapper.list(deptCode);
    }

    @Override
    public TCharge chargeInfo(String patientCode, String patientCureNo) {
        QueryWrapper<TCharge> qw = new QueryWrapper<>();
        qw.eq(TCharge.PatientCode_,patientCode)
                .eq(TCharge.PatientCureNo_,patientCureNo);
        List<TCharge> list = chargeMapper.selectList(qw);
        if(list == null){
            return null;
        }else{
            return list.get(0);
        }
    }
}
